package dca.sistemascontrole.view;

import dca.sistemascontrole.handler.HandlerMainFrame;
import dca.sistemascontrole.view.grafico.GraficoNivel;
import dca.sistemascontrole.view.grafico.GraficoTensao;

/**
 *
 * @author Rafael
 */
public class PanelOpcoesGrafico extends javax.swing.JPanel {

    private GraficoNivel graficoNivel;
    private GraficoTensao graficoTensao;
    private HandlerMainFrame handlerMainFrame;

    public PanelOpcoesGrafico(GraficoNivel graficoNivel, GraficoTensao graficoTensao, HandlerMainFrame handlerMainFrame) {
        initComponents();
        this.graficoNivel = graficoNivel;
        this.graficoTensao = graficoTensao;
        this.handlerMainFrame = handlerMainFrame;
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel3 = new javax.swing.JPanel();
        chkExibirTanqueSuperior = new javax.swing.JCheckBox();
        chkExibirTanqueInferior = new javax.swing.JCheckBox();
        chkExibirSetpoint = new javax.swing.JCheckBox();
        chkExibirErro = new javax.swing.JCheckBox();
        btnLimparGrafico = new dca.sistemascontrole.view.components.CustomButton();
        jPanel1 = new javax.swing.JPanel();
        chkExibirUSaturado = new javax.swing.JCheckBox();
        chkExibirUp = new javax.swing.JCheckBox();
        chkExibirUi = new javax.swing.JCheckBox();
        chkExibirUd = new javax.swing.JCheckBox();
        chkExibirU = new javax.swing.JCheckBox();

        setBackground(new java.awt.Color(255, 255, 255));

        jPanel3.setBackground(new java.awt.Color(255, 255, 255));
        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Variáveis de Nível"));

        chkExibirTanqueSuperior.setBackground(new java.awt.Color(255, 255, 255));
        chkExibirTanqueSuperior.setSelected(true);
        chkExibirTanqueSuperior.setText("Nível no tanque superior");
        chkExibirTanqueSuperior.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkExibirTanqueSuperiorActionPerformed(evt);
            }
        });

        chkExibirTanqueInferior.setBackground(new java.awt.Color(255, 255, 255));
        chkExibirTanqueInferior.setSelected(true);
        chkExibirTanqueInferior.setText("Nível no tanque inferior");
        chkExibirTanqueInferior.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkExibirTanqueInferiorActionPerformed(evt);
            }
        });

        chkExibirSetpoint.setBackground(new java.awt.Color(255, 255, 255));
        chkExibirSetpoint.setSelected(true);
        chkExibirSetpoint.setText("Setpoint");
        chkExibirSetpoint.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkExibirSetpointActionPerformed(evt);
            }
        });

        chkExibirErro.setBackground(new java.awt.Color(255, 255, 255));
        chkExibirErro.setSelected(true);
        chkExibirErro.setText("Erro");
        chkExibirErro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkExibirErroActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(chkExibirSetpoint, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(chkExibirErro, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(chkExibirTanqueSuperior, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(chkExibirTanqueInferior, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(chkExibirTanqueSuperior)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(chkExibirTanqueInferior)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(chkExibirSetpoint)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(chkExibirErro)
                .addContainerGap(15, Short.MAX_VALUE))
        );

        btnLimparGrafico.setBackground(new java.awt.Color(250, 250, 250));
        btnLimparGrafico.setText("Limpar Gráficos");
        btnLimparGrafico.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLimparGraficoActionPerformed(evt);
            }
        });

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Variáveis de Tensão"));

        chkExibirUSaturado.setBackground(new java.awt.Color(255, 255, 255));
        chkExibirUSaturado.setSelected(true);
        chkExibirUSaturado.setText("Sinal de controle Saturado");
        chkExibirUSaturado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkExibirUSaturadoActionPerformed(evt);
            }
        });

        chkExibirUp.setBackground(new java.awt.Color(255, 255, 255));
        chkExibirUp.setSelected(true);
        chkExibirUp.setText("Sinal de Controle Proporcional");
        chkExibirUp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkExibirUpActionPerformed(evt);
            }
        });

        chkExibirUi.setBackground(new java.awt.Color(255, 255, 255));
        chkExibirUi.setSelected(true);
        chkExibirUi.setText("Sinal de Controle Integrativo");
        chkExibirUi.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkExibirUiActionPerformed(evt);
            }
        });

        chkExibirUd.setBackground(new java.awt.Color(255, 255, 255));
        chkExibirUd.setSelected(true);
        chkExibirUd.setText("Sinal de Controle Derivativo");
        chkExibirUd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkExibirUdActionPerformed(evt);
            }
        });

        chkExibirU.setBackground(new java.awt.Color(255, 255, 255));
        chkExibirU.setSelected(true);
        chkExibirU.setText("Sinal de controle");
        chkExibirU.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkExibirUActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(chkExibirUd, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(chkExibirUSaturado, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(chkExibirU, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(chkExibirUi, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(chkExibirUp, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(chkExibirUp)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(chkExibirUi)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(chkExibirUd, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(chkExibirUSaturado)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(chkExibirU)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnLimparGrafico, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnLimparGrafico, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(163, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void chkExibirTanqueSuperiorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkExibirTanqueSuperiorActionPerformed
        graficoNivel.exibirNivelTanqueSuperior(chkExibirTanqueSuperior.isSelected());
    }//GEN-LAST:event_chkExibirTanqueSuperiorActionPerformed

    private void chkExibirTanqueInferiorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkExibirTanqueInferiorActionPerformed
        graficoNivel.exibirNivelTanqueInferior(chkExibirTanqueInferior.isSelected());
    }//GEN-LAST:event_chkExibirTanqueInferiorActionPerformed

    private void chkExibirUSaturadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkExibirUSaturadoActionPerformed
        graficoTensao.exibirUSaturado(chkExibirUSaturado.isSelected());
    }//GEN-LAST:event_chkExibirUSaturadoActionPerformed

    private void btnLimparGraficoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLimparGraficoActionPerformed
        graficoNivel.clear();
        graficoTensao.clear();
        if (handlerMainFrame != null) {
            handlerMainFrame.clear();
        }
    }//GEN-LAST:event_btnLimparGraficoActionPerformed

    private void chkExibirSetpointActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkExibirSetpointActionPerformed
        graficoNivel.exibirSetpoint(chkExibirSetpoint.isSelected());
    }//GEN-LAST:event_chkExibirSetpointActionPerformed

    private void chkExibirErroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkExibirErroActionPerformed
        graficoNivel.exibirErro(chkExibirErro.isSelected());
    }//GEN-LAST:event_chkExibirErroActionPerformed

    private void chkExibirUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkExibirUpActionPerformed
        graficoTensao.exibirUp(chkExibirUp.isSelected());
    }//GEN-LAST:event_chkExibirUpActionPerformed

    private void chkExibirUiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkExibirUiActionPerformed
        graficoTensao.exibirUi(chkExibirUi.isSelected());
    }//GEN-LAST:event_chkExibirUiActionPerformed

    private void chkExibirUdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkExibirUdActionPerformed
        graficoTensao.exibirUd(chkExibirUd.isSelected());
    }//GEN-LAST:event_chkExibirUdActionPerformed

    private void chkExibirUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkExibirUActionPerformed
        graficoTensao.exibirU(chkExibirU.isSelected());
    }//GEN-LAST:event_chkExibirUActionPerformed

    public void setHandlerMainFrame(HandlerMainFrame handlerMainFrame) {
        this.handlerMainFrame = handlerMainFrame;
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private dca.sistemascontrole.view.components.CustomButton btnLimparGrafico;
    private javax.swing.JCheckBox chkExibirErro;
    private javax.swing.JCheckBox chkExibirSetpoint;
    private javax.swing.JCheckBox chkExibirTanqueInferior;
    private javax.swing.JCheckBox chkExibirTanqueSuperior;
    private javax.swing.JCheckBox chkExibirU;
    private javax.swing.JCheckBox chkExibirUSaturado;
    private javax.swing.JCheckBox chkExibirUd;
    private javax.swing.JCheckBox chkExibirUi;
    private javax.swing.JCheckBox chkExibirUp;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3;
    // End of variables declaration//GEN-END:variables
}
